<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->

<div class="row">
    <div class="col-lg-12">
        <h3 class="page-header">Trả lời câu hỏi</h3>
    </div>
    <!-- /.col-lg-12 -->
</div>
<div class="row">
    <div class="col-lg-12">
        <div class="panel panel-default">
            <div class="panel-body">
                 <div class="row">
                    <div class="col-lg-9">                       
                    <!--<div class="col-lg-12">--> 
                       <div class="form-group"></div> 
                        <div class="col-lg-12"> 
                            <div class="row">
                                <div class="form-group">
                                   <a class="" href="<?php echo $this->url(array("action"=>"messger")) ?>">   <button type="reset" class="btn btn-default" id ="answer">Gửi câu hỏi</button></a>
                                   <a class="" href="<?php echo $this->url(array("action"=>"address")) ?>"> <button type="reset" class="btn btn-default" id ="answer">Trả lời thông báo</button></a>
                                </div>   
                            </div>                            
                            <div class="row">
                                <div class="form-group" id="form_addquestion">
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                                <?php
                                    echo "<div id=\"accordion\" class='col-lg-12'>";
                                   foreach($this->data as $item)
                                   {
                                       if($item->getAnswer()=="") $answer = "Chưa có câu trả lời.";
                                       else $answer=$item->getAnswer();
                                       echo" <section id=\"item".$item->getId()."\">
                                              <p class=\"pointer\" \">&#9654;</p><h1><p><b>".  GlobalLib::getName("user", $item->getUser_Id(), "last_name")." ".GlobalLib::getName("user", $item->getUser_Id(), "first_name")." (".GlobalLib::getName("user", $item->getUser_Id(), "username")."): ".$item->getTitle()."</b></p><p>".$item->getQuestion()."</p></h1>
                                              <p class=\"content\">".$answer."</p>
                                            </section><br/>";
                                   }
                                   echo " </div>";
                                ?>
                                <?php 
                                   echo $this->paginationControl($this->data, 'Sliding' , 'feedback/pagination.phtml'); 
                                ?>
                        </div>
                    </div>   
<!--                     //////tin tuchun///-->
   <div class="col-lg-3"> 
                             <div class="form-group">
                                 <h4><b>THÔNG TIN KHUYẾN MÃI</b></h4>
                            </div>  
                            <div class="form-group">                                
                            
                            <ul class="chat">
                            <?php
                    foreach ($this->items1 as $item) {
                        
                            if ($item->getEvent() == 1) {
                            ?>
                            <li class="left clearfix">
                                <span class="chat-img pull-left">
                                    <img src="<?php echo $this->ImageUrl() ?>/image/icon-hot.gif" alt="User Avatar" class="img-circle">
                                </span>
                                <div class="chat-body clearfix">
                                    <div class="header">
                                        <strong class="primary-font"><a href="#" id="pop-up" onclick="getNewsDetail('<?php echo $this->baseUrl() ?>/default/news/newsdetail',<?php echo $item->getId() ?>,'title','description','content')"><?php echo $item->getTitle() ?></a>
                                        
                                            </strong>
                                    </div>
                                    <small class="text-muted">
                                            <i class="fa fa-clock-o fa-fw"></i> <?php echo GlobalLib::viewDate($item->getCreated()) ?>
                                        </small>
                                    <p>
                                        <?php echo $item->getDescription() ?>
                                        <i class="pull-right"><i class=" fa fa-long-arrow-right"></i><a href="#" id="pop-up" onclick="getNewsDetail('<?php echo $this->baseUrl() ?>/default/news/newsdetail',<?php echo $item->getId() ?>,'title','description','content')">Đọc thêm</a></i>
                                    </p>
                                    
                                </div>
                            </li>
                    <?php } } ?> 
                                </ul>
                            </div>
                    </div>  
<!--////-->
<!-- modal -->
<div id="myModal" class="modal fade">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;</button>
                    <h4 class="modal-title">
                        <center>
                            <strong id="title"></strong>
                        </center>
                    </h4>
                </div>
                <div class="modal-body">    
                    <strong id="description"></strong><br>
                    <p id="content"></p>
                    
                </div>                    
            </div>
        </div>
    </div>
<!--//-->
                </div>
            </div>
        </div>
    </div>   
</div>
<style>
    #accordion {
      margin-bottom:30px;
      
    }
    #accordion h1 {
      background-color: #EEF5EE;
      line-height:1.2;
      font-size:15px;     
      margin:0;
      padding: 10px 10px 10px 30px;      
    }
    #accordion section :hover{
      background-color: #EEE;           
    }
    #accordion h1 a {
      color:black;
    }
    #accordion section {
      overflow:hidden;
      height:220px;
      border:1px #EEF5EE solid;
      border-radius: 15px;
      //box-shadow: 10px 10px 5px #888888;
    }
    #accordion p {
      padding:0 10px;
      color:black;      

    }
    #accordion section.ac_hidden p:not(.pointer) {
      color: #333;
    }

    #accordion section.ac_hidden {
      height:auto;
    }
    #accordion .pointer {
      padding:0;
      margin:10px 0 0 6px;
      line-height:20px;
      width:13px;
      position:absolute;
    }
    #accordion section:not(.ac_hidden) h1 {      
      //background-color:#4F9822;//mau khi ta click chuot
    }
    #accordion section:not(.ac_hidden) .pointer {
      display:block;
      -webkit-transform:rotate(90deg);
      -moz-transform:rotate(90deg);
      -o-transform:rotate(90deg);
      transform:rotate(90deg);
      padding:0;
      height: auto;
      width: auto;
    }
</style>
<script>
    $(document).ready(function() {
        
        ////
        $("#accordion section").addClass("ac_hidden");        
        $("#accordion section p.content").hide();
        $("#accordion section h1").click(function(e) {
            $(this).parents().siblings("section").addClass("ac_hidden");
            $(this).parents("section").removeClass("ac_hidden");
            $("#accordion section p.content").hide();
            $(this).parent("section").children("p").show();
            e.preventDefault();
        });
    });
</script>
<script type="text/javascript">
   $('#myModal').modal('hide');
  function getNewsDetail(url,news_id,title_id,description,content_id){
    
    var params={
      news_id:news_id 
    };
    $.post(url,params,function(datas){
        $('#myModal').modal('show'); 
        
        var items=datas.split('[]');
        //alert(items[0]+"co du lieu");
        
        
        //alert(jItem.title);
        //exit();
        if(items[0]!=''){
            //alert("co");
           $('#title').html(items[0]);
           $('#description').html(items[1]);
           $('#content').html(items[2]);
        }
    });
}
        </script>

